﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
public $zongjia;

	function __construct($zongjia)
	{
		$this->zongjia    = $zongjia;
	}
}




   if($_POST["sid"]!="")
   {
   $de=$_POST["sid"]*30;
   }
    else
	{
	$de=0;
	}
	$uid=$_REQUEST[uid];
	
	

if($_REQUEST[d]==1)
{
$states=1;
$state3=3;
 $srat=mysql_query("update car set state='".$states."' where userid='".$_REQUEST[userid]."' and state='".$state3."'");
 $zongj=0;
}
else
{
$states=1;
$state3=3;
 $srat=mysql_query("update car set state='".$states3."' where userid='".$_REQUEST[userid]."' and state='".$state1."'");
	
	$zongj=0;

	$rert30=mysql_query("select *from car where userid='".$_REQUEST[userid]."' and state='".$state."' ");
	
	while($rowf=mysql_fetch_array($rert30)){
	
	$zongj=$zongj+$rowf[price]*$rowf[number];
	
	}
}
	

$prize = array();
	
	
$prize[] = new MyPrizeBean($zongj);
		


echo json_encode($prize);


?>